//
// Created by xili on 2024/8/5 20:26.
// Go big or go home.
//
#include "vector"

using namespace std;

//差分数组
class Solution {
public:
    int numberOfPoints(vector<vector<int>> &nums) {
        vector<int> v(102, 0);
        int ans = 0;
        for (auto &item: nums) {
            v[item[0]]++;
            v[item[1] + 1]--;
        }
        for (int i = 1; i < 102; i++) {
            v[i] += v[i - 1];
            ans += v[i] > 0 ? 1 : 0;
        }
        return ans;
    }
};